<?php

namespace app\api\controller;

use app\api\model\house\HouseMedia;
use app\api\model\house\HouseParkMedia;
use app\common\controller\Api;
use app\api\model\house\HousePark as HouseParkModel;
use app\api\model\house\HouseEvaluate as HouseEvaluateModel;

class Housepark extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];


    //推荐园区
    public function recommend()
    {
        $model = new HouseParkModel();
        $param = input();
        $list = $model->recommend($param);
        $this->success('',$list);
    }

    //园区列表
    public function lists()
    {
        $model = new HouseParkModel();
        $param = input();
        $list = $model->lists($param);
        $this->success('',$list);
    }

    //园区详情
    public function info()
    {
        $park_id = input('park_id',0);
        $park_info = \app\api\model\house\HousePark::get(['park_id'=>$park_id]);
        if (!$park_info){
            $this->error('园区不存在');
        }
        $park_info['media_json'] = HouseParkMedia::where(['park_id'=>$park_info['park_id']])->select();
        $this->success('',$park_info);
    }

}